import request from '@/utils/request'
import qs from 'qs'

export function list(index, size) {
    return request({
        url: '/api/admin/list.do',
        method: 'get',
        params: {
            size,
            index
        }
    })
}

export function del(id) {
    return request({
        url: '/api/admin/delete.do',
        method: 'get',
        params: {
            id
        }
    })
}

export function add(nickname, roleId, roleName, username, password) {
    return request({
        url: '/api/admin/addOrUpdate.do',
        method: 'post',
        data: qs.stringify({
            nickname,
            roleId,
            roleName,
            username,
            password
        })
    })
}

export function update(id,nickname, roleId, roleName, username, password) {
    return request({
        url: '/api/admin/addOrUpdate.do',
        method: 'post',
        data: qs.stringify({
            id,
            nickname,
            roleId,
            roleName,
            username,
            password
        })
    })
}
